package com.web;

import com.pojo.QingXu_x;
import com.service.QingXuService_x;
import com.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("qingxu")
@CrossOrigin(origins = "http://localhost:8081",maxAge = 3600)
public class QingXuController_x {
    @Autowired
    private QingXuService_x qingXuServiceX;

    @RequestMapping("select")
    public List<QingXu_x> findById(Integer id){
        return qingXuServiceX.findById(id);
    }

    @RequestMapping("add")
    Result add(QingXu_x qingXuX){
        return Result.ok(qingXuServiceX.add(qingXuX));
    }
    @RequestMapping("update")
    Result update(QingXu_x qingXuX){
        return Result.ok(qingXuServiceX.update(qingXuX));
    }
    @RequestMapping("delete")
    Result delete(Integer id){
        return Result.ok(qingXuServiceX.delete(id));
    }
    @RequestMapping("selectAll")
    public List<QingXu_x> select(Integer id, String title, String content) {
        return qingXuServiceX.select(id, title, content);
    }
}
